let arr = [5, 6, 7, 8, 1, 2, 3];
arr.splice(0, 1, 777);
console.log([...arr]); // [777, 6, 7, 8, 1, 2, 3]
arr.splice(0, 2, 456, 456, 456, 456);
// 指定位置修改，多出的部分会直接增加上去
console.log([...arr]); // [456, 456, 456, 456, 7, 8, 1, 2, 3]
let months = ['Jan', 'March', 'April', 'June'];
// 从0开始，删掉一个
months.splice(0, 1);
console.log([...months]); // ['March', 'April', 'June']
months.splice(0, 2);
console.log([...months]); // ['June']
let arr1 = [
  { name: 'zg', age: 18 },
  { name: 'kobe', age: 35 },
  { name: 'lucy', age: 22 },
];
arr1.splice(1, 2);
console.log([...arr1]);
/**结果
  {name: 'zg', age: 18}
*/
